<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMembersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('members', function (Blueprint $table) {
            $table->id();
            $table->string('nickname', 128)->default('')->comment('昵称');
            $table->string('real_name', 32)->default('')->comment('真实姓名');
            $table->string('login_name', 32)->default('')->comment('登录名');
            $table->string('login_pass', 128)->default('')->comment('登录密码');
            $table->string('fund_pass', 128)->default('')->comment('资金密码');
            $table->string('phone', 16)->default('')->comment('手机号');
            $table->string('id_no', 32)->default('')->comment('身份证号码');
            $table->string('id_img_front', 256)->default('')->comment('身份证正面');
            $table->string('id_img_back', 256)->default('')->comment('身份证反面');
            $table->integer('province')->default(0)->comment('省份');
            $table->integer('city')->default(0)->comment('市');
            $table->integer('area')->default(0)->comment('区县');
            $table->string('address_info', 128)->default('')->comment('家庭住址详情');
            $table->tinyInteger('login_type')->default(1)->comment('登录方式');
            $table->string('openid', 128)->default('')->comment('openid');
            $table->string('unionid', 128)->default('')->comment('unionid');
            $table->tinyInteger('status')->default(1)->comment('状态 详情见模型');
            $table->timestamps();
            $table->index('phone');
            $table->index('real_name');
            $table->index('login_name');
            $table->index('province');
            $table->index('city');
            $table->index('area');
            $table->index('status');
            $table->index('openid');
            $table->index('unionid');
        });
        DB::statement("ALTER TABLE `members` comment '会员表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('members');
    }
}
